#include<stdio.h>
#include<string.h>
#include<stdlib.h>


#define COMMAND_SIZE 1024 
const char*  GetUser()
{
  const char* username = getenv("USER");
  return username == NULL?"None":username;
}

const char* GetHostname()
{
  const char* hostname  = getenv("HOSTNAME");
  return hostname == NULL?"None":hostname;
}

const char* GetPwd()
{
  const char* pwd = getenv("PWD");
  return pwd == NULL?"None":pwd;
}

int main()
{
  printf("[%s@%s %s]#",GetUser(),GetHostname(),GetPwd());

  //获取数据
  char commandline[COMMAND_SIZE];
  char* r = fgets(commandline,sizeof(commandline),stdin);
  if(r == NULL) return 1;
  printf("%s\n",commandline);
  //清理\n
  commandline[strlen(commandline)-1] = 0;

  return 0;
}
